public class Test {
    public static void main(String[] args) {
        BinaryTree bt = new BinaryTree();
        BinaryTree.TreeNode root = bt.createTree();

        System.out.print("先序：");
        bt.preOrder(root);
        System.out.println();
        System.out.print("中序：");
        bt.inOrder(root);
        System.out.println();
        System.out.print("后序：");
        bt.postOrder(root);
        System.out.println();
        System.out.print("层序：");
        bt.levelOrder(root);

        System.out.println("树中节点的个数：");
        bt.size(root);
        System.out.println(BinaryTree.nodeSize);
        System.out.println(bt.size2(root));

        System.out.println("叶子节点的个数：");
        bt.getLeafNodeCount1(root);
        System.out.println(BinaryTree.leafSize);
        System.out.println(bt.getLeafNodeCount2(root));

        //K层节点的个数
        System.out.println("第3层节点的个数：");
        System.out.println(bt.getKLevelNodeCount(root,3));

        //二叉树的高度
        System.out.println("二叉树的高度：");
        System.out.println(bt.getHeight(root));


        //元素是否存在
        System.out.println("查找元素是否存在：");
        System.out.println(bt.find(root,'E').val);

        //判断一棵树是不是完全二叉树
        System.out.println("判断一棵树是不是完全二叉树：");
        if(bt.isCompleteTree(root)) {
            System.out.println("是二叉树");
        }
        else {
            System.out.println("不是二叉树");
        }

        bt.levelOrder2(root);
    }
}
